package com.project.logistics.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.logistics.bean.Repairman;
import org.apache.ibatis.annotations.*;

/**
 * Created by94988 on 2021/3/19 18:20
 */
@Mapper
public interface RepairmanMapper extends BaseMapper<Repairman> {
    @Delete("delete from repairman where user_id = #{userId}")
    boolean deleteById2(String userId);

    @Select("select * from repairman where user_id = #{id}")
    Repairman findRepairmanById(String id);

    @Update("update repairman set repairman_name = #{repairmanName} ,repairman_telephone = #{repairmanTelephone},repairman_photo = #{repairmanPhoto} where user_id = #{userId}")
    int updateRepairman(Repairman repairman);

    @Update("update repairman set repair_count = #{repairCount}  where user_id = #{repairmanId}")
    int setCount(@Param("repairCount") int repairCount, @Param("repairmanId") String repairmanId);

    //查看当前维修人信息（通过报修单号）
    @Select("select * from repairman where user_id=#{userId}")
    Repairman getRepairmanByUserId(String userId);

    @Select("select * from repairman where repairman_status=1")
    Repairman getTodayRepairman();

    @Update("update repairman set repairman_status = 0 where user_id = #{userId}")
    int deleteTodayRepairman(String userId);

    @Update("update repairman set repairman_status = 1 where user_id = #{userId}")
    int updateTodayRepairman(String userId);

}
